package com.woniuxy.user.controller;

import com.woniuxy.common.entity.Product;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: 曾令忠
 * @Description:
 * @Date: 2020/7/10 0010-下午 11:13
 */
@RestController
public class UserController {
    @Resource
    RestTemplate restTemplate;
    @RequestMapping("/all")
    public List<Product> getAllProduct(){
        return restTemplate.getForObject("http://PRODUCT/all",List.class);
    }
    @RequestMapping("/hi")
    public String hi(){
        String name = "张三";
        return restTemplate.getForObject("http://PRODUCT/hi?name="+name,String.class);
    }
}
